package GUI;

import java.io.FileInputStream;
import java.io.IOException;
import java.sql.*;
import java.util.Properties;

public class DataBaseConn {
    private static Connection conn = null;
    private static Statement stmt = null;
    private static ResultSet set = null;

    static {
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String user = "system";
        String password = "123456";
        String url = "jdbc:oracle:thin:@//localhost:1521/orcl";
        try {
            conn = DriverManager.getConnection(url, user, password);
            stmt = conn.createStatement();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public static void connClose() {
        try {
            conn.close();
            stmt.close();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    public Connection getConn() {
        try {
            return conn;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
